﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Road3App.ViewModels;

namespace Road3App.Views.UserControls.EditControls
{
    /// <summary>
    /// Interaction logic for EditPhases.xaml
    /// </summary>
    public partial class EditPhasesPage : Page
    {
        EditCrossRoadPhasesViewModel _viewModel;

        public EditPhasesPage()
        {
            InitializeComponent();
            this.DataContextChanged += EditPhasesPage_DataContextChanged;
        }

        void EditPhasesPage_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            _viewModel = this.DataContext as EditCrossRoadPhasesViewModel;
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            _viewModel.AddPhase();
        }

        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            _viewModel.InsertPhase();
        }

        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            _viewModel.RemovePhase();
        }

        private void EditGridUC_MouseDown_1(object sender, MouseButtonEventArgs e)
        {
            _viewModel.SaveStates();
        }
    }
}
